home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 14 / Example 14.1 / debug.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2006-07-16  |  897 b   |  30 lines

  1. #include "debug.h"
  2.  
  3. //////////////////////////////////////////////////////////////////////////////////////////
  4. //                                DEBUG                                                    //
  5. //////////////////////////////////////////////////////////////////////////////////////////
  6.  
  7. std::ofstream out("debug.txt");
  8.  
  9.  
  10. DEBUG::DEBUG()
  11. {
  12.     
  13. }
  14.  
  15. DEBUG::~DEBUG()
  16. {
  17.     if(out.good())
  18.         out.close();
  19. }
  20.  
  21. void DEBUG::Print(char c[])
  22. {
  23.     out << c << std::endl;
  24. }
  25. std::ofstream& DEBUG::operator<<(char c[]){out << c; return out;}
  26. std::ofstream& DEBUG::operator<<(int i){out << i; return out;}
  27. std::ofstream& DEBUG::operator<<(float f){out << f; return out;}
  28. std::ofstream& DEBUG::operator<<(bool b){if(b)out << "True"; else out << "False"; return out;}
  29. std::ofstream& DEBUG::operator<<(D3DXVECTOR3 v){out << "x: " << v.x << ", y: " << v.y << ", z: " << v.z;return out;}
  30. void DEBUG::Endl(int nr){for(int i=0;i<nr;i++)out << std::endl;}